<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="128px"
    >
      <el-form-item label="合格供应商名称" prop="supName">
        <el-input
          v-model="queryParams.supName"
          placeholder="请输入供应商名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="supplierList" border>
      <el-table-column
        label="供应商名称"
        align="center"
        prop="supName"
        width="200px"
      />
      <el-table-column
        label="企业性质"
        align="center"
        prop="etpNat"
        width="120px"
      />
      <el-table-column label="注册资本" align="center" prop="regMoney" >
        <template slot-scope="scope">
          <div>{{ scope.row.regMoney+"万元" }}</div>
        </template>
      </el-table-column>
      <el-table-column label="法人" align="center" prop="legPerson" />
      <el-table-column label="联系方式" align="center" prop="unitRegPhone" />
      <el-table-column label="开户行" align="center" prop="bank" />
      <el-table-column
        label="单位注册地址"
        align="center"
        prop="unitRegAdd"
        width="350"
      />

     
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
  </div>
</template>

<script>
import {
  listSupplier,
  getSupplier,
  delSupplier,
  addSupplier,
  updateSupplier,
} from "@/api/basic/supplier";

export default {
  name: "Supplier",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 供应商信息表格数据
      supplierList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        supName: null,
        unitRegPl: null,
        etpNat: null,
        legPerson: null,
        unitContactAdd: null,
        operRange: null,
        copyProfile: null,
        busLicense: null,
        lelPersonJust: null,
        lelPersonBack: null,
        bank: null,
        bankAdd: null,
        unitRegAdd: null,
        regMoney: null,
        mciType: null,
        lelPersonCard: null,
        busLicentTime: null,
        bankAccount: null,
        unitRegPhone: null,
        paidUpCapital: null,
        auditStatus: null,
        supViews: null,
        supPassword: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  created() {
    this.getList();
  },
  methods: {
  
    /** 查询供应商信息列表 */
    getList() {
      this.loading = true;
      this.queryParams.auditStatus = 2;
      listSupplier(this.queryParams).then((response) => {
        this.supplierList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.handleQuery();
    },
  },
};
</script>
